﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ITAP.Core.Calculations.Search
{
    public class SearchTreeNode
    {
        private int level = 0;

        public int Level
        {
            get { return level; }
            set { level = value; }
        }

        private double value;

        public double Value
        {
            get { return this.value; }
        }

        SearchTreeNode parent;

        public SearchTreeNode Parent
        {
            get { return parent; }
        }
        List<SearchTreeNode> childs;

        public List<SearchTreeNode> Childs
        {
            get { return childs; }
        }

        private SearchTreeNode[] childsArray;

        public SearchTreeNode[] ChildsArray
        {
            get { return childsArray; }
            set { childsArray = value; }
        }

        public SearchTreeNode(SearchTreeNode parent, double value, int level)
        {
            this.parent = parent;
            this.value = value;
            this.level = level;
            this.childs = new List<SearchTreeNode>();
        }

        public void Clear()
        {
            if (this.childs != null)
            {
                foreach (SearchTreeNode child in this.childs)
                    childs.Clear();
                this.childs.Clear();
            }
            this.parent = null;
        }
    }
}
